﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="LanguagePairService.cs" company="WordSteps.com">
//   All rights reserved
// </copyright>
// <summary>
//   Defines the LanguagePairService type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace RapidDict.Modules.LanguagePairService.Services
{
    using System;
    using RapidDict.Infrastructure.Interfaces;
    using RapidDict.Infrastructure.Models;

    public class LanguagePairService : ILanguagePairService
    {
        public event EventHandler SourceLanguageChanged;
        public event EventHandler TargetLanguageChanged;

        private Language sourceLanguage;
        private Language targetLanguage;

        public LanguagePairService()
        {
            this.sourceLanguage = Language.English;
            this.targetLanguage = Language.Russian;
        }

        public Language GetSourceLanguage()
        {
            return this.sourceLanguage;
        }

        public Language GetTargetLanguage()
        {
            return this.targetLanguage;
        }

        public void SetSourceLanguage(Language lang)
        {
            this.sourceLanguage = lang;
            if (this.SourceLanguageChanged != null)
            {
                this.SourceLanguageChanged(this, EventArgs.Empty);
            }
        }

        public void SetTargetLanguage(Language lang)
        {
            this.targetLanguage = lang;
            if (this.TargetLanguageChanged != null)
            {
                this.TargetLanguageChanged(this, EventArgs.Empty);
            }
        }
    }
}